home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / var / lib / dpkg / info / usplash.postinst < prev    next >
Text File  |  2008-10-16  |  2KB  |  94 lines

  1. #!/bin/bash -e
  2. # This script can be called in the following ways:
  3. #
  4. # After the package was installed:
  5. #       <postinst> configure <old-version>
  6. #
  7. #
  8. # If prerm fails during upgrade or fails on failed upgrade:
  9. #       <old-postinst> abort-upgrade <new-version>
  10. #
  11. # If prerm fails during deconfiguration of a package:
  12. #       <postinst> abort-deconfigure in-favour <new-package> <version>
  13. #                  removing <old-package> <version>
  14. #
  15. # If prerm fails during replacement due to conflict:
  16. #       <postinst> abort-remove in-favour <new-package> <version>
  17.  
  18. . /usr/share/debconf/confmodule
  19.  
  20. # Remove the alternative for the default artwork we used to ship
  21. rm_default_artwork()
  22. {
  23.     update-alternatives --remove usplash-artwork.so \
  24.         /usr/lib/usplash/usplash-default.so
  25. }
  26.  
  27. # Update the initramfs
  28. update_initramfs()
  29. {
  30.     if which update-initramfs >/dev/null 2>&1; then
  31.         update-initramfs -u
  32.     fi
  33. }
  34.  
  35. # Write a config file
  36. setup_usplash_config()
  37. {
  38.     if [ ! -f /etc/usplash.conf ]; then
  39.         echo "# Usplash configuration file" >/etc/usplash.conf
  40.         echo "# These parameters will only apply after running update-initramfs." >>/etc/usplash.conf
  41.         echo "" >>/etc/usplash.conf
  42.         db_version 2.0
  43.         x=
  44.         y=
  45.         if db_get xserver-xorg/config/display/modes; then
  46.             FIRSTVAL=`echo $RET | sed 's/,.*//'`
  47.             x=`echo $FIRSTVAL | sed 's/x.*//'`
  48.             y=`echo $FIRSTVAL | sed 's/.*x//'`
  49.         elif [ "$DISPLAY" ] && which xdpyinfo >/dev/null 2>&1 && \
  50.              dimensions="$(xdpyinfo | perl -nle 'if (/^\s*dimensions:\s*(\d+x\d+)/) { print $1; exit }')"; then
  51.             x="${dimensions%%x*}"
  52.             y="${dimensions#*x}"
  53.         fi
  54.         if [ "$x" ] && [ "$y" ]; then
  55.             echo "xres=$x" >>/etc/usplash.conf
  56.             echo "yres=$y" >>/etc/usplash.conf
  57.         fi
  58.     fi
  59. }
  60.  
  61. case "$1" in
  62.     configure)
  63.     if dpkg --compare-versions "$2" lt-nl "0.3-1"; then
  64.         rm_default_artwork
  65.     fi
  66.  
  67.     if dpkg --compare-versions "$2" lt-nl "0.4-31" && \
  68.         [ ! -e /usr/lib/usplash/usplash-artwork.so ]; then
  69.         update-alternatives --auto usplash-artwork.so
  70.     fi
  71.  
  72.     setup_usplash_config
  73.  
  74.     update_initramfs
  75.     ;;
  76.  
  77.     abort-upgrade|abort-deconfigure|abort-remove)
  78.     ;;
  79.  
  80.     *)
  81.     echo "$0 called with unknown argument \`$1'" 1>&2
  82.     exit 1
  83.     ;;
  84. esac
  85.  
  86. # Automatically added by dh_installinit
  87. if [ -x "/etc/init.d/usplash" ]; then
  88.     update-rc.d usplash start 98 2 3 4 5 . stop 02 0 1 6 . >/dev/null || exit $?
  89. fi
  90. # End automatically added section
  91.  
  92.  
  93. exit 0
  94.